package edu.cque.hello;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Hua
 * @create 2022-03-25 16:00
 */
@RequestMapping("car")
@RestController  //是springmvc提供的,可以被浏览器访问  ResponseBody 将响应的数据变成json串
public class CarController {
    @RequestMapping("show")
    public String show(){
        return "浏览器访问成功";
    }

    @RequestMapping("add")
    //参数类型和参数名称必须和请求的参数[类型,名称]一致,
    public String add(String mutex){
        return mutex;
    }
    @RequestMapping("smell")
    public String smell( String hello, int date){
        System.out.println("hello = " + hello);
        System.out.println("date = " + date);
        return hello+"------"+date;
    }
    //框架作用: 1, 解析了请求参数,2,把解析的参数调用XX.set()方法设置值.
    @RequestMapping("save")
    public Car save(Car car){
        System.out.println("car = " + car);
        return car;
    }















}
